{{extend ('./layout.html')}}

{{#block ("body")}}
{{extend ('./menu.html')}}
<div class="main-container">
	<div class="padding-md">
		<ul class="breadcrumb">
			<li><span class="primary-font"><i class="icon-home"></i></span><a href="index.html"> Home</a></li>
			<li>Table</li>
			<li>Datatable</li>
		</ul>
		<!-- {{#if(checkAction('userAdd'))}}
		<button onclick="location.href='/student/studentAdd';" type="button" class="btn btn-success btn-sm">添加账号</button>
		{{/if}} -->
		<table class="table table-striped" id="dataTable">
			<thead>
			<tr>
				<th>ID</th>
				<th>学生姓名</th>
				<th>学生用户名</th>
				<th>学生学号</th>
				<th>专业</th>
				<th>学校</th>
				<th>年级</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{{#each(array)}}
			<tr>
				<td>{{this.stu_id}}</td>
				<td>{{this.stu_name}}</td>
				<td>{{this.user_name}}</td>
				<td>{{this.stu_number}}</td>
				<td>{{this.class_name}}</td>
				<td>{{this.school_name}}</td>
				<td>{{this.grade_name}}</td>
				<td>
					{{#if(this.checkAction('userEdit'))}}
					<a href="/student/studentEdit?stu_id={{this.stu_id}}">编辑</a>
					{{/if}}
					{{#if(this.checkAction('userDelete'))}}
					<a href="#" onclick="Delete({{this.stu_id}})">删除</a>
					{{/if}}
				</td>
			</tr>
			{{/each}}

			</tbody>
		</table>

		<ul class="pagination">

			<!--上翻页-->
			{{#if( page<=1 )}}
			<li class="disabled">
				<a>
					<span>&laquo;</span>
				</a>
			</li>
			{{else}}
			<li>
				<a href="/student/studentList?page={{page-1}}" aria-label="Previous">
					<span aria-hidden="true">&laquo;</span>
				</a>
			</li>
			{{/if}}

			<!--中间页码-->
			{{#each(totalPageArray)}}
			{{#if(page===this)}}
				<li class="active"><a>{{this}}</a></li>
			{{else}}
				<li>
					<a href="/student/studentList?page={{this}}">{{this}}</a>
				</li>
			{{/if}}
			{{/each}}


			<!--下翻页-->
			{{#if(page >= totalPage)}}
			<li class="disabled">
				<a aria-label="Next">
					<span aria-hidden="true">&raquo;</span>
				</a>
			</li>
			{{else}}
			<li>
				<a href="/student/studentList?page={{page+1}}" aria-label="Next">
					<span aria-hidden="true">&raquo;</span>
				</a>
			</li>
			{{/if}}



		</ul>
	</div><!-- ./padding-md -->
</div><!-- /main-container -->
<script type="text/javascript">
function Delete(delete_id)
{
	// console.log(123);
	if(delete_id)
	{
		if(confirm("确定删除该学生信息？"))
		{
			location.href='/student/studentDelete?delete_id='+delete_id;
		}else{
			location.href='/student/studentList';
		}

	}
}
</script>
{{/block}}